<%-- 
    Document   : CreerStage
    Created on : 18 mars 2013, 21:21:20
    Author     : Fabien
--%>

<%@page import="java.util.ArrayList"%>
<%@page import="com.myapp.bean.Etudiant"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>liste etudiant secretariat</title>
        <script type="text/javascript">

        </script>
        <link rel="stylesheet" href="JSP/style/style.css">
    </head>
    <body>
        <%-- Ici, pour eviter le doublons de jsp on affiche le header en fonction du type de personne qui se connecte --%>

        <% if (request.getSession().getAttribute("typeCo").equals("secretariatCo")) {%>
        <header><%@ include file="../headers/menuSecretariat.jsp"%></header>
        <% } else if (request.getSession().getAttribute("typeCo").equals("enseignantCo")) {%>
        <header><%@ include file="../headers/menuEnseignant.jsp"%></header>
        <% }%> 

        <div id="contenu">
            <h2> Liste des etudiants de la MIAGE </h2> <br>
            <form method="post" action="RecherchePromoAffFicheSe.do">

                <h3> Selectionnez une promotion : </h3>
                <select name="promotion">
                    <% ArrayList<Etudiant> listEtudiants = (ArrayList) request.getAttribute("listEtudiants");
                        if (listEtudiants == null) {%>
                    <option value="L3C" selected>L3C</option>
                    <option value="M1C">M1C</option>
                    <option value="M2C">M2C</option>
                    <% } else if (listEtudiants.get(0).getNiveau() == 4) {%>
                    <option value="L3C">L3C</option>
                    <option value="M1C" selected>M1C</option>
                    <option value="M2C">M2C</option>
                    <% } else if (listEtudiants.get(0).getNiveau() == 5) {%>
                    <option value="L3C">L3C</option>
                    <option value="M1C">M1C</option>
                    <option value="M2C" selected>M2C</option>
                    <% } else {%>
                    <option value="L3C" selected>L3C</option>
                    <option value="M1C">M1C</option>
                    <option value="M2C">M2C</option>
                    <% }%>
                </select>
                <input type="submit" value="Valider" name="Valider" />
            </form>



            <%
                if (request.getAttribute("listEtudiants") != null) {
            %>
            <table border=0>
                <thead>
                    <tr>

                        <td>Nom</td>
                        <td>Prenom</td>
                        <td>Promotion</td>
                        <td>Fiche</td>
                    </tr>
                </thead>

                <tbody>
                    <% for (Etudiant e : listEtudiants) {%>
                    <form method="post" action="RecherchePromoAffFicheSe.do">
               
                    <tr>
                        <td> <%=e.getNom()%> </td>
                        <td> <%=e.getPrenom()%> </td>
                        <td><%=e.getTypeFormation()%></td>
                
                    <input type="hidden" name="choix"/>
                    <td><input type="submit" name="AfficherFiche" value="Afficher Fiche" /></td>
                    <input type="hidden" name="nCandidat" value="<%=e.getnCandidat()%>" />
                    <input type="hidden" name="promotion" value="<%=e.getPromotion() %>" />
                    
                    </tr> 
                    </form>
                


                <%}%>
                </tbody> 
            </table>
             
            <%   }%>

                                                          

    </div>
    <footer><%@ include file="../headers/Footer.jsp"%></footer>
</body>
</html>
